from django.shortcuts import render

# Create your views here.

from rest_framework.viewsets import GenericViewSet, ModelViewSet
from rest_framework.mixins import UpdateModelMixin
from utils.Ops_mixins import OpsListModelMixin, OpsDestroyModelMixin, OpsCreateModelMixin, OpsUpdateModelMixin
from variable.models import System_variable
from variable.serializer import VariableModelSerializerr
from utils.Ops_page import HostPage
from rest_framework.filters import SearchFilter


class VariableView(OpsListModelMixin, OpsDestroyModelMixin, OpsUpdateModelMixin, OpsCreateModelMixin, GenericViewSet):
    '''
    环境变量类
    '''
    queryset = System_variable.objects.filter()
    serializer_class = VariableModelSerializerr

    pagination_class = HostPage
    filter_backends = [SearchFilter]
    search_fields = ['var_lable', 'var_name']
